package xyz.maxwells.bigdata.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import xyz.maxwells.bigdata.dao.CommentRepository;
import xyz.maxwells.bigdata.domain.data.Comment;
import xyz.maxwells.bigdata.service.CommentService;

import java.util.List;

/**
 * Created by wuzusheng on 2018/5/13.
 */
@Service
public class CommentServiceImpl implements CommentService{
    @Autowired
    private CommentRepository dao;
    @Override
    public List<Comment> findByTableName(String tableName, Sort sort) {
        return dao.findByTableName(tableName,sort);
    }

    @Override
    public List<Comment> findByUserName(String userName) {
        return dao.findByUserName(userName);
    }

    @Override
    public void delete(Long id) {
        dao.delete(id);
    }

    @Override
    public void save(Comment comment) {
        dao.save(comment);
    }

    @Override
    public Comment findone(Long id) {
        return dao.findOne(id);
    }

    @Override
    public Page<Comment> list(Specification<Comment> spec, Pageable pageable) {
        return dao.findAll(spec,pageable);
    }
}
